#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    int a[n+5],vis[n+5];
    memset(vis,0,sizeof(vis));
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int num=0;
    for(int i=1;i<n/2;i++){
        if(a[i-1]<a[i]){
            vis[i-1]=1;
        }
    }
    if(n/2*2>n){
        for(int i=n/2+1;i<n;i++){
            if(a[i-1]<a[i]){
                vis[i-1]=1;
            }
        }
        if(a[(n+1)/2]>a[n-1]){
            vis[n-1]=1;
        }
    }else{
        for(int i=n/2;i<n;i++){
            if(a[i-1]<a[i]){
                vis[i-1]=1;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(vis[i]==0) num++;
    }
    cout<<num;
    fclose(stdin);
    fclose(stdout);
    return 0;
}
